package it.ilgrv.demiurgo.persistence;

import java.util.List;

/**
 * implements common function to be used on entity classes
 * 
 * @author massimiliano
 * 
 */
public class GenericTable {

	/**
	 * return first data of the list or null if it dosen't exist
	 * 
	 * @param list
	 * @return
	 */
	protected static <T> T getFirstData(List<T> list) {
		if (list == null || list.size() == 0) {
			return null;
		} else {
			return list.get(0);
		}
		
	}

	/**
	 * return true if esxist at least one item, false otherwise
	 * 
	 * @param list
	 * @return
	 */
	protected static <T> boolean isExist(List<T> list) {
		if (list == null || list.size() == 0) {
			return false;
		} else {
			return true;
		}
	}

}
